/**
 * 项目示例-列表综合搜索
 * Date 2023-5-25 09:33:56
 */
import type { FilterItem } from "@/components/FilterBar/types";
import {
  createUserOrgIdData,
  eqptFloorData,
  // getEqptFloorData,
  getRepairFindProblem,
  repairFindEqptData,
  repairFindProblemData,
  terminalData,
} from "./options";
import { watch } from "vue";

export const exampleOptions: FilterItem[] = [
  {
    label: "报修单号",
    prop: "repCode",
    type: "input",
    span: 6,
    inputProps: {
      clearable: true,
      placeholder: "请输入报修单号",
    },
  },
  {
    label: "设备类型",
    prop: "eqptTypeId",
    defaultValue: "",
    type: "treeSelect",
    span: 6,
    inputProps: {
      data: repairFindEqptData,
      "default-expand-all": true,
      clearable: true,
    },
    events: {
      change: (value, evt) => {
        evt.setFieldsValue({ problemId: "" });
        repairFindProblemData.value = [];
        value != "1" && getRepairFindProblem(value);
      },
    },
  },
  {
    label: "问题类型",
    prop: "problemId",
    type: "select",
    defaultValue: "",
    span: 6,
    inputProps: {
      options: repairFindProblemData,
    },
  },
  {
    label: "紧急程度",
    prop: "urgency",
    type: "select",
    defaultValue: "",
    span: 6,
    inputProps: {
      options: [
        { label: "非常紧急", value: "1" },
        { label: "一般紧急", value: "2" },
        { label: "一般", value: "3" },
      ],
    },
  },
  {
    label: "上报单位",
    prop: "createUserOrgId",
    type: "treeSelect",
    defaultValue: "",
    span: 6,
    inputProps: {
      data: createUserOrgIdData,
      "default-expand-all": true,
      clearable: true,
    },
  },
  {
    label: "楼层",
    prop: "eqptFloor",
    type: "select",
    defaultValue: "",
    span: 6,
    inputProps: {
      options: eqptFloorData,
    },
  },
  {
    label: "上报人",
    prop: "createUserName",
    type: "input",
    defaultValue: "",
    span: 6,
    inputProps: {},
  },
  {
    label: "受理单位",
    prop: "organId",
    type: "treeSelect",
    defaultValue: "",
    span: 6,
    inputProps: {
      data: createUserOrgIdData,
      "default-expand-all": true,
      clearable: true,
    },
  },
  {
    label: "报修时间",
    prop: "startTime",
    type: "datePicker",
    span: 12,
    inputProps: {
      type: "datetimerange",
      "value-format": "YYYY-MM-DD HH:mm:ss",
      "range-separator": "至",
      "start-placeholder":"YYYYMMDD HH:MM",
      "end-placeholder":"YYYYMMDD HH:MM",
      defaultTime: [
        new Date(new Date().getFullYear(), new Date().getMonth(), new Date().getDate(), 0, 0, 0),
        new Date(new Date().getFullYear(), new Date().getMonth(), new Date().getDate(), 23, 59, 59)
      ]
    },
  },
  {
    label: "航站楼",
    prop: "terminal",
    type: "checkbox",
    defaultValue: [],
    span: 6,
    inputProps: {
      // 控制是否显示权限功能
      showCheckAll: false,
      options: terminalData,
    },
    // events: {
    //   change: (value, evt) => {
    //     evt.setFieldsValue({ eqptFloor: "" });
    //     getEqptFloorData(value);
    //   },
    // },
  },
];